;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; C++
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;(define-key c++-mode-base-map (kbd "RET") 'newline-and-indent)
;(setq c-default-style "linux")
;(setq c-basic-offset 4
;      tab-width 4
;      indent-tabs-mode t)
;(add-hook 'c-mode-common-hook '(lambda () (c-toggle-auto-state 1)))
(setq c-indent-tabs-mode t             ; Pressing TAB should cause indentation
      c-indent-level 4                 ; A TAB is equivilent to four spaces
      c-argdecl-indent 0               ; Do not indent argument decl's extra
      c-tab-always-indent t
      backward-delete-function nil)    ; do NOT expand tabs when deleting them
(c-add-style "my-c-style" '((c-continued-statement-offset 4))) ; If a statement continues on the next line, indent the continuation by 4
(defun my-c-mode-hook ()
  (setq display-line-number-format "%4d|")
  (custom-set-variables '(line-spacing 0))
  (c-set-style "my-c-style")
  (c-set-offset 'substatement-open '0) ; brackets should be at same indentation level as the statements they open
  (c-set-offset 'inline-open '+)
  (c-set-offset 'block-open '+)
  (c-set-offset 'brace-list-open '+)   ; all "opens" should be indented by the c-indent-level
  (c-set-offset 'case-label '+))       ; indent case labels by c-indent-level, too
(add-hook 'c-mode-hook 'my-c-mode-hook)
(add-hook 'c++-mode-hook 'my-c-mode-hook)
